<%@ page language="java" contentType= "text/html" pageEncoding="UTF-8"%>
<%@include file="/include/common/griduihead1.jsp"%>
<%@include file="/include/common/griduihead2.jsp"%>
<%
	page1.getPageTitle().setTitle("請假單查詢");
	page1.setSpOpen(false);
	page1.getPageTitle().setEnab(false);
	//page1.getToolbar().setEnab(false);
	Map newOption = new LinkedHashMap();
	newOption.put("新增(人資)", "rz");
		
	Map searchOption = new LinkedHashMap();
	searchOption.put("查询","{id:'search1',value:'',confirm:'true',disabled:'false'}");
	searchOption.put("列出須審核資料","xs");
%>
<jm:form>
	<jm:layout postion="north" >
		<jm:toolbar newDisabled="false" newOption="<%=newOption%>" searchOption="<%=searchOption%>" searchConfirm="true" xlsConfirm="true"  />
		<jm:pageTitle />
		<jm:sp id="sp1" data="<%=Utils.TAG_FORM%>" tabSize="2" >
			<jm:tab colModel="200px;200px;*">
				<jm:group colspan="3" caption="隱藏欄位" hidden="true">
					<input caption="hr021tsn" name="tsn" type="text" />	
					<input caption="xs" name="xs" type="text" />
				</jm:group>
				
				<jm:org caption="部門" name="org" lock="1,2,3" />
				<input caption="請假者工號" name="hrnum1" type="text" rule="custom:v_hrnum1" />
				<input caption="中英文姓名%" name="cename" type="text" />
				
				<input caption="審核者工號 " type="text" name="checkHrnum" />
				<jm:select caption="假别" name="hr013tsn" utils="<%=utils%>" dataSource="info3" sql="select tsn,leavekind from hr..hr013" />
				<jm:group colModel="200;*" captionDisplay="false">
					<jm:calendar name="sdate" caption="填寫日期" calConfig="onpicked:function(){$dp.$('edate').focus();}"/>
        			<jm:calendar name="edate" caption="~" captionWidth="10px"/>
				</jm:group>
                
                <jm:select caption="計酬方式" name="jobCode" codeList="計件工人;計件幹部;計時工人;計時幹部" />
                <input caption="列出未簽核 " type="checkbox" name="qh" value="1" />
                <jm:group colModel="200;*" captionDisplay="false">
        			<jm:calendar name="qsdate" caption="請假日期" calConfig="onpicked:function(){$dp.$('qedate').focus();}"/>
        			<jm:calendar name="qedate" caption="~" captionWidth="10px"/>
                </jm:group>
			</jm:tab>
			<jm:tab colModel="20%;20%;60%">	
				<input caption="工號2" name="hrnum14" type="text"  value="" />
				<select caption="測試4" name="hrnum15"><option value="1">1</option><option value="2">2</option><option value="3">3</option></select>
			</jm:tab>
		</jm:sp>
		<jm:error></jm:error>
	</jm:layout>
	
	<jm:layout postion="center" export="true">
		<jm:export jxl="true" sheetname="請假單" exportConfig="x:1,y:1">
		<jm:table id="grid1" width="1500px" exportConfig="border:'all thin black'" view="fixedRow">
			<jm:thead >
					<tr exportConfig="bgcolor:'ocean_blue'">	
						<td rowspan="2">工號</td>
						<td colspan="12">明细</td>
					</tr>
					<tr exportConfig="bgcolor:'ocean_blue'">	
						<td>簽核</td>
						<td width="40px">姓名</td>
						<td width="10%">公司別</td>
						<td width="10%">部門</td>
						<td width="5%">類別</td>
						<td width="15%"><jm:html>請假時間</jm:html></td>
						<td width="5%" exportConfig="type:'number'">天數</td>
						<td width="10%">簽核情況</td>
						<td width="5%">填寫日期</td>
						<td width="5%">國別區域</td>
						<td width="15%">請假說明</td>
						<td width="5%">列印</td>
					</tr>
			</jm:thead>
			<jm:tbody>
				<%
					List list = (List)ret.getSerchResult();
					for(int i = 0 ;list != null && i<list.size();i++){
						BaseDataEntity row = (BaseDataEntity)list.get(i);
						boolean bEnab = "1".equals(row.gpsv("enab"));
						
						PageJsGear.registerTableRowData(page1,"grid1",i,row,"hrnum1");
						%>
							<tr bgcolor="<%=row.gpsv("bgcolor")%>">
							<td> <%
									if(bEnab && !row.isNullOrEmpty("editPage")){
										%><a href="<%=row.gpsv("editPage")%>" title="點擊工號進入編輯畫面"><%=row.gpsv("hrnum1")%></a><%
									}else{
										%><%=row.gpsv("hrnum1")%><%
									}
							%></td>
							<td><%
									if(bEnab && !row.isNullOrEmpty("checkPage")){
										%><a href="<%=row.gpsv("checkPage")%>" title="點擊工號進入簽核畫面"><font color="#FF0000"><b>簽核</b></font></a><%
									}else{
										%>&nbsp;<%
									}
							%></td>
							<td exportconfig="font-color:'pink'" ><%=row.gpsv("cName")%></td>
							<td><%=row.gpsv("companyNameCh")%></td>
							<td><%=row.gpsv("ChFullName")%></td>
							<td><%
								if(bEnab){
									%><a target="blank" href="/jmPro/staff/staff042E.jsp?tsn=<%=row.gpsv("tsn")%>&HRNum1=<%=row.gpsv("hrNum1")%>" title="點擊請假類別進入工作交接單畫面"><%=row.gpsv("leaveKind")%></a><%
								}else{
									%><%=row.gpsv("leaveKind")%><%
								}
							%></td>
							<td><%=row.gpsv("startDay")%>~<br><%=row.gpsv("endDay")%></td>
							<td exportconfig="font-color:'<%=row.gpiv("days") >= 1 ? "red" : "black"%>'"><%=row.gpsv("days")%></td>
							<td><%=bEnab ? row.gpsv("status"):"已取消"%></td>
							<td><%
									if(bEnab && !row.isNullOrEmpty("RzCheckPage")){
										%><a target="blank"  href="<%=row.gpsv("RzCheckPage")%>" title="人資部點此進入修改畫面"><font color="#FF0000"><b><%=row.GetFormatDate("crtDay")%></b></font></a><%
									}else{
										%><%=row.GetFormatDate("crtDay")%><%
									}
							%></td>
							<td><%=row.gpsv("AddrCty")%></td>
							<td exportconfig="wrap:'true'"><%=row.gpsv("rem")%></td>
							<td><%
								if(bEnab){
									%><a target="blank" href="/jmPro/staff/staff045Q.jsp?tsn=<%=row.gpsv("tsn")%>&HRNum1=<%=row.gpsv("hrNum1")%>" title="點擊此進入列印畫面"><u>列印</u></a><%
								}else{
									%>列印<%
								}
							%></td>
							</tr>
						<%
					}
				%>
			</jm:tbody>
			<jm:tfoot>
				<tr>
					<td colspan="13">总计信息</td>
				</tr>
			</jm:tfoot>
		</jm:table>
		</jm:export>
	</jm:layout>
	<jm:layout postion="south" >test</jm:layout>
</jm:form>
<jm:script><script type="text/javascript" charset="UTF-8">
	//以下定义 action function ,on+action 命名function
	//new action
	function onnew(actionvalue){
		var url = '';
		switch (actionvalue) {
			case 'rz'://批量請假
				url = '/jmPro/staff/staff136E.jsp';break;
			default://普通假單
				$P.openwin('http://www.google.com','new','','',0,0);break;
		}
		if(url != '')
			window.location.href = url;
		return false;
	}
	
	//工号验证
	function v_hrnum1(_me){
		if($(_me).val() == '')return true ;
			
		var rs = {ret:0,msg:"無此工號!"},p = {};
		p['action'] = "v_hrnum1";
		p['hrnum'] = $(_me).val();
		
		var doaction = function(jo){
			 if(jo != undefined && jo.ret == 1)
				 rs.ret = 1;
		};
		
		$P.ajax({data : p,succ :doaction,isValidate:true});
		return rs;
	}
</script></jm:script>
<%@include file="/include/common/griduiend.jsp"%>


